package domain;
import java.util.LinkedHashMap;
import java.util.Map.Entry;

public class LRUCache<K, V> extends LinkedHashMap<K, V> {

    /**
     * Default value
     */
    private static final long serialVersionUID = 1L;

    private int mMaxEntries;

    public LRUCache(int maxEntries) {
        super(maxEntries + 1, 1, true);
        mMaxEntries = maxEntries;
    }

    @Override
    protected boolean removeEldestEntry(Entry<K, V> eldest) {
        return size() > mMaxEntries;
    }
    
    

}